package edu.stu.cs.software.family.admin.domain;



import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import edu.stu.cs.software.family.base.domain.BaseTreeEntity;
/**
 * Team is extended by the base class BaseTreeEntity
 * The primary key is the id of BaseEntity
 * Have attributes name and subclass users;
 * @author Administrator
 *
 */
@Table(name = "O_ADMIN_TEAM")
@Entity
@NamedQueries({ @NamedQuery(name = "Team.getRoot", query = "select g from Team g where g.parent is null") })
public class Team extends BaseTreeEntity<Team, Long>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Column(name = "NAME")
	String name;

	@OneToMany(mappedBy = "team", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	Set<User> users;
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	
}
